package com.yanqu.road.server.channelserver.timer;

import com.yanqu.road.server.ChannelBaseServer;
import com.yanqu.road.server.TempMgr;
import com.yanqu.road.utils.executor.GeneralTask;

public class ChannelMgrDataSaveTask extends GeneralTask {

    @Override
    public void doRun() {
        for (TempMgr baseMgr : ChannelBaseServer.getInstance().getMgrList()) {
            try {
                long stratTime = System.currentTimeMillis();
                baseMgr.save();
                long cost = System.currentTimeMillis() - stratTime;
                getLOGGER().info("{} save cost {} mills.", baseMgr.getClass().getSimpleName(), cost);
            } catch (Exception e) {
                getLOGGER().error("{} save error.", baseMgr.getClass().getSimpleName(), e);
            }
        }
    }

}
